import axios from '@/utils/axios.js'

/*
 * 外层字典定义
 */

// 查询字典列表
export const getDictList = params => {
    return axios({
        url: 'sys/dict/getDictList',
        method: 'get',
        params,
        mock: true
    })
}
// 新增字典
export const addDict = data => {
    return axios({
        url: 'sys/dict/addDict',
        method: 'post',
        data
    })
}
// 禁用启用
export const dictEnable = params => {
    return axios({
        url: 'sys/dict/disOrEnableDict',
        method: 'post',
        params,
        mock: true
    })
}
// 编辑字典
export const editDict = data => {
    return axios({
        url: 'sys/dict/editDict',
        method: 'post',
        data,
        mock: true
    })
}

// 删除字典
export const deleteDict = params => {
    return axios({
        url: 'sys/dict/delDict',
        method: 'post',
        params,
        mock: true
    })
}
/*
 * 键值对的字典
 */

// 根据字典id获取字典的键值对列表
export const getDictKeyValList = params => {
    return axios({
        url: '/sys/dictDataManager/getDictDataList',
        method: 'get',
        params,
        mock: true
    })
}
// 新增
export const addDictKeyVal = data => {
    return axios({
        url: 'sys/dict/addDictData',
        method: 'post',
        data,
        mock: true
    })
}
// 编辑
export const editDictKeyVal = data => {
    return axios({
        url: 'sys/dictDataManager/editDict',
        method: 'post',
        data,
        mock: true
    })
}

// 启用禁用
export const dictKeyValEnable = params => {
    return axios({
        url: 'sys/dictDataManager/disOrEnableDictData',
        method: 'post',
        params,
        mock: true
    })
}

// 查询所有的字典列表
export const getAllDictList = params => {
    return axios({
        url: '/sys/dictManager/getAllDictList',
        method: 'get',
        params,
        mock: true
    })
}

// 删除字典数据
export const deleteKeyValue = params => {
    return axios({
        url: 'sys/dictDataManager/delete',
        method: 'post',
        params,
        mock: true
    })
}
